<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>手风琴</title>
		<style>
		*{
			margin: 0;
			padding: 0;
			list-style-type: none;
		}
			
			.web{
				width:200px;
				margin: 20px;
			}
			
			.web li{
				margin: 5px 0;
			}
			
			h3{
				font-size: 14px;
				text-align: center;
				border: 1px solid #333333;
				cursor: pointer;
			}
			.content{
				width: 200px;
				height: 150px;
				text-overflow: ellipsis;
				overflow: hidden;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				font-size: 12px;
				text-align: center;
				padding: 5px;
				box-sizing: border-box;
			}
			
			.none{
				display: none;
			}
		</style>
	</head>
	<body>
		<ul class="web">
			<li>
				<h3>item01</h3>
				<div class="content">
					Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quibusdam nesciunt maxime veniam at eaque repellendus eveniet blanditiis sed voluptas architecto id amet corporis in nobis recusandae aut quasi explicabo cupiditate?
				</div>
			</li>
			<li>
				<h3>item02</h3>
				<div class="content none">
					Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quibusdam nesciunt maxime veniam at eaque repellendus eveniet blanditiis sed voluptas architecto id amet corporis in nobis recusandae aut quasi explicabo cupiditate?
				</div>
			</li>
			<li>
				<h3>item03</h3>
				<div class="content none">
					Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quibusdam nesciunt maxime veniam at eaque repellendus eveniet blanditiis sed voluptas architecto id amet corporis in nobis recusandae aut quasi explicabo cupiditate?
				</div>
			</li>
		</ul>
		<script>
			var items = document.querySelector('.web').children;
			for ( let i = 0; i < items.length; i++ ) {
				items[i].lastElementChild.setAttribute('data-id',i);
				items[i].addEventListener('click', function(){
					for ( var j = 0; j <　items.length;　j++ ) {
						items[j].lastElementChild.style.display = 'none';
					}
						this.lastElementChild.style.display = 'block';
				});
			}
		</script>
	</body>
</html>
